<?php include('./templete/public/head.php') ?>
<body>
<!--评估-->
<div class="assess-main">
    <div class="assess-content ">
        <form class="myform">
            <div class="c-top">
                <ul class="comm-table-view">

                    <li class="table-view-cell table-view-cell2">
                        <a>
                            <span>理由</span>
                            <div class="top-text text2">
                                <textarea name="content"></textarea>
                            </div>
                        </a>
                    </li>

                </ul>
            </div>
            <hr class="bgcolor"/>
            <input type="hidden" name="id" value="<?php echo $rows['id'] ?>">
        </form>
        <div class="comm-btn assess-btn">

            <?php if($rows['status']!=5){?>
                <span class="color1 " onclick="deal()">通过</span>
            <span class="color2 " onclick="deny()">不实施</span>
            <?php }else{?>
                <span class="color1 " style="width: 100%" onclick="deal()">完成</span>
            <?php }?>
        </div>
    </div>
</div>
<script src="_js/plug/mui.picker.all.js"></script>
<?php include('./templete/public/script.php') ?>
</body>

<script>
    function deny() {
        layer.confirm('确认不实施提议吗？', {
            btn: ['确认', '取消']
        }, function () {
            let load = layer.load();
            param = $('.myform').serializeArray();
            $.ajax({
                    url: "<?php echo url('deny')?>",
                    type: 'post',
                    data: param,
                    success: function (data) {
                        layer.close(load);
                        layer.msg(data.msg);
                        if (data.code == 1) {
                            setInterval(function () {
                                location.href = "<?php echo url('detail', ['id' => $rows['id']])?>"
                            }, 2000)
                        }
                    }
                }
            )
        }, function () {
            layer.msg('操作已取消');
        })
    }
    function deal() {
        layer.confirm('确认通过/完成提议吗？', {
            btn: ['确认', '取消']
        }, function () {
            let load = layer.load();
            param = $('.myform').serializeArray();
            $.ajax({
                    url: "<?php echo url('deal')?>",
                    type: 'post',
                    data: param,
                    success: function (data) {
                        layer.close(load);
                        layer.msg(data.msg);
                        if (data.code == 1) {
                            setInterval(function () {
                                location.href = "<?php echo url('detail', ['id' => $rows['id']])?>"
                            }, 2000)
                        }
                    }
                }
            )
        }, function () {
            layer.msg('操作已取消');
        })
    }
</script>
</html>